****** Figure 1: Share of Countries with At Least One Duty
* set maxvar 10000
use "Data_Duties_Master.dta", clear

gen duties_any = 0
replace duties_any=1 if duties_total>0
replace duties_any=0 if duties_total==.

gen duties_any2 = duties_any if intl_state_system ==1

unique origin if duties_total!=.  & year==2017 & intl_state_system ==1

br origin if duties_total==.  & year==2017 & intl_state_system ==1

* keep if intl_state_system ==1
tab year


br origin year duties_total duties_any duties_any2 intl_state_system 
sort year origin

collapse (sum) duties_any (mean) duties_any2, by(year)

keep if year <2018

twoway (line duties_any year, yaxis(1) lwidth(thick) lcolor(red)) ///
		(line duties_any2 year, yaxis(2) lwidth(thick) lcolor(blue) lpattern(dash)) ///
, xlabel(#10) ylabel(#10) ///
title("") xtitle("Year") ytitle("Number of Countries", axis(1)) ytitle("Share of Countries", axis(2))  ///
 xlabel(1781 1800(25)2000 2017)  ///
    ylabel(0(0.1)0.7, axis(2)) ///
yscale(noextend) xscale(noextend) ///
legend(order(1 "Number of Countries with at Least One Duty " 2 "Share of Countries with at Least One Duty ") position(6) rows(2) region(lstyle(none)))


graph export "Figure_1.pdf", replace
